#pragma once

#include "ProcTableEntry.h"
#include <vector>
#include <map>
using namespace std;

class ProcTable{
private:
	int indexCount;
	map<string, ProcTableEntry> procIndex;
	map<int, ProcTableEntry> revIndex;
public:

	/**
	 * Initialises an empty ProcTable
	 */
	ProcTable();

	/**
	 * Adds a procedure to this ProcTanle
	 * @param procName the name of the procedure to be added
	 * @return the index of the procedure in the ProcTable
	 */
	int addProc(string procName);

	/**
	 * Adds a node ID to the procedure with the given index
	 * @param procIndex the index of the procedure
	 * @param nodeID the node ID to be added
	 * @return True if the node ID is successfully added. False if the node ID already exists.
	 */
	bool addProcNodeID(int procIndex, int nodeID);

	/**
	 * Retrieves the index of the procedure with the given name
	 * @param procName the name of the procedure
	 * @return the index of the procedure
	 */
	int getIndex(string procName);

	/**
	 * Retrieves the name of the procedure with the given index
	 * @param procIndex the index of the procedure
	 * @return the name of the procedure
	 */
	string getProcName(int procIndex);

	/** 
	 * Returns the list of AST nodes that contains the procedure with the given index
	 * @param procIndex the index of the procedure
	 * @return A vector containing the AST node IDs where the procedure with the given index can be found
	 */
	vector<int> getNodeIDs(int index);
	
	/**
	 * Returns the size of this ProcTable
	 * @return the number of entries contained in this ProcTable
	 */
	int size();
};